<?php
namespace api\modules\v1\controllers;

use api\common\controllers\AController;
use common\records\ToyMachine;
use yii\data\ActiveDataProvider;

class MachineController extends AController
{
    public $modelClass = 'common\records\ToyMachine';
    /**
     * @api {get} /v1/machines 娃娃机列表
     * @apiVersion 1.0.0
     * @apiName index
     * @apiGroup machines 
     *
     *
     */
    public function actionInfo()
    {
        $mid = $_POST['mid'];
        $query = ToyMachine::find()->where(['mid' => $mid]);
        return new ActiveDataProvider([
            'query' => $query,
            'pagination' => [
                'pageSize' => 1,
            ],
            'sort' => [
                'defaultOrder' => [
                    'id' => SORT_DESC
                ]
            ]
        ]);
    }
}
